ePaper (IL3820) module Library  v0.5
Library for the 2.9-inch WaveShare ePaper display module
il3820_sleepWake.c
1 /*
2  * @file il3820_sleepWake.c
3  *
4  * @author Matthew Matz & Roy Eltham
5  *
6  * @version 0.5
7  *
8  * @copyright Copyright (C) Parallax, Inc. 2018. See end of file for
9  * terms of use (MIT License).
10  *
11  * @brief Waveshare ePaper display bitmap driver, see il3820_h. for documentation.
12  *
13  * @detail Please submit bug reports, suggestions, and improvements to
14  * this code to editor@parallax.com.
15  */
16 
17 
18 #include "il3820.h"
19 #include "simpletools.h"
20 
21 
22 void il3820_sleepDisplay(screen_t *dev)
23 {
24  int mask_cs = (1 << dev->dev_id);
25  int mask_sdi = (1 << dev->sdi_pin);
26  int mask_clk = (1 << dev->clk_pin);
27  int mask_dc = (1 << dev->dc_pin);
28 
29  il3820_writeLockSet(dev->dev_id);
30  il3820_spiWrite(mask_cs, mask_sdi, mask_clk, mask_dc, IL3820_DEEP_SLEEP_MODE, 0);
31  il3820_spiWrite(mask_cs, mask_sdi, mask_clk, mask_dc, 1, 1);
32  il3820_writeLockClear(dev->dev_id);
33 }
34 
35 void il3820_wakeDisplay(screen_t *dev)
36 {
37  il3820_writeLockSet(dev->dev_id);
38  il3820_resetDisplay(dev);
39  il3820_writeLockClear(dev->dev_id);
40 }
41